<template>
  <div class="main">
    <div class="left">
      <studentMainleft></studentMainleft>
    </div>
    <div class="right">
      <template>
        <el-table :data="Results" style="width: 100%">
          <el-table-column prop="OpeningDate" label="开课日期" width="180"></el-table-column>
          <el-table-column prop="name" label="姓名" width="180"></el-table-column>
          <el-table-column prop="address" label="地址"></el-table-column>
        </el-table>
      </template>
    </div>
  </div>
</template>

<script>
import studentMainleft from "@/components/studentMainleft";
export default {
  components: {
    studentMainleft
  },
  data() {
    return {
      user: "",
      Results: [],
      Course: [],
      Worker:[]
    };
  },
  created() {
    this.GetResultsByToken();
    this.GetAllCourse();
    this.GetAllWorker()
  },
  mounted() {},
  methods: {
    GetAllWorker() {
        this.$axios({
         method:'get',
         url:this.$api.GetAllWorker,
        data:{},
        params:{},
         }).then((res)=>{
         console.log(res)
         this.Worker = res.data.message
        })
    },
    GetAllCourse() {
      this.$axios({
        method: "get",
        url: this.$api,
        data: {},
        params: {}
      }).then(res => {
        this.Course = res.data.message;
      });
    },
    GetResultsByToken() {
      this.user = JSON.parse(sessionStorage.getItem("user"));
      this.$axios({
        method: "get",
        url: this.$api.GetResultsByToken,
        data: {},
        params: { token: this.user.Token }
      }).then(res => {
        console.log(res);
        this.Results = res.data.message;
      });
    }
  }
};
</script>

<style scoped>
.main {
  display: flex;
  height: 100%;
}
.right {
  width: 100%;
  background-color: white;
  height: 80%;
  margin-left: 10px;
  padding: 0px 20px 0 20px;
}
</style>
